package wisp.gui;

//GTGE GUI
import com.golden.gamedev.gui.*;
import com.golden.gamedev.gui.toolkit.*;

//JFC
import java.awt.Color;

//wisp
import wisp.dataObjects.*;
import wisp.game.PlayerSprite;

public class LootWindow extends TFloatPanel{
	
	private PlayerSprite player;
	
	//Loot window / monster can hold upto 6 diff items muna lawlz.	
	
	private TPanel[] box = new TPanel[6];
	private TButton[] getButton = new TButton[6];
	private TLabel[] nameLabel = new TLabel[6];
	private TLabel[] quantityLabel = new TLabel[6];
	private TLabel[] descriptionLabel = new TLabel[6];

	//private Item[] itemList = new Item[6];
	
	public LootWindow(PlayerSprite p){
		super("Loot Window", true, true, 100, 100, 220, 720);
		
		player = p;
		int x = 0;
		
		for(int i = 0; i < 6; i++){
			box[i] = new TPanel(0,x,220,80);
			
			x += 80;
		}
		
		addItem(0);
		addItem(1);
		addItem(2);
		addItem(3);
		addItem(4);
		addItem(5);
		
		for(int k = 0; k < 6; k++){
			this.add(box[k]);
		}
	}
	
	public void addItem(int pos/*, Item i */ ){
		getButton[pos] = new TButton("GET", 140, 10, 40, 40){
			public void doAction(){
				//ADD this item to the players inventory if clicked
				
				//check if there is free space in the inventory
				//move to inventory
				
				System.out.println("[LOOT] Player gets " /* + Item.name */);
				this.update();
			}
		};
		
		nameLabel[pos] = new TLabel("ITEM_NAME", 5, 10, 80, 20);
		quantityLabel[pos] = new TLabel("QTY", 100, 10, 40, 20);
		descriptionLabel[pos] = new TLabel("I'm an item!\nMade in China:D", 5, 40, 140, 40);

		box[pos].add(getButton[pos]);
		box[pos].add(nameLabel[pos]);
		box[pos].add(quantityLabel[pos]);
		box[pos].add(descriptionLabel[pos]);
		
	}	

}
